import java.io.*;

/**
 * @author zyj
 * @date 2022年05月30日 11:06
 */
public class ObjectInputStreamDemo {
    public static void main(String[] args) {
        ObjectInputStream ois = null;
        InputStream in = null;
        try {
            in = new FileInputStream("b.txt");
            ois = new ObjectInputStream(in);
           Student s = (Student) ois.readObject();
            System.out.println(s);
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }finally {
            try {
                ois.close();
                in.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
}
